//元素距离页面顶部的偏移量=当前元素对于父元素的offsettop+父元素再对上层元素的offsettop，如此循环
export function getoffsettop(document){
    let offset=document.offsetTop;
    while(document.offsetParent){
        document=document.offsetParent;
        offset+=document.offsetTop;
    }
    return offset;
}